home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / datepart.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  900 b   |  39 lines

  1. <!--- This example shows information available from datePart --->
  2.  
  3. <HTML>
  4.  
  5. <HEAD>
  6. <TITLE>
  7. DatePart Example
  8. </TITLE>
  9. </HEAD>
  10.  
  11. <CFSET todayDate = #Now()#>
  12. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  13. <BODY  bgcolor="#FFFFD5">
  14.  
  15. <H3>DatePart Example</H3>
  16.  
  17. <P>Today's date is <CFOUTPUT>#todayDate#</CFOUTPUT>.
  18.  
  19. <P>Using datepart, we can extract an integer representing
  20. the various dateparts from that value
  21. <CFOUTPUT>
  22. <UL>
  23.     <LI>year: #DatePart("yyyy", todayDate)#
  24.     <LI>quarter: #DatePart("q", todayDate)#
  25.     <LI>month: #DatePart("m", todayDate)#
  26.     <LI>day of year: #DatePart("y", todayDate)#
  27.     <LI>day: #DatePart("d", todayDate)#
  28.     <LI>weekday: #DatePart("w", todayDate)#
  29.     <LI>week: #DatePart("ww", todayDate)#
  30.     <LI>hour: #DatePart("h", todayDate)#
  31.     <LI>minute: #DatePart("n", todayDate)#
  32.     <LI>second: #DatePart("s", todayDate)#
  33. </UL>    
  34.     
  35. </CFOUTPUT>    
  36. </BODY>
  37.  
  38. </HTML>       
  39.